package 剑指offer_leetcode;

/**
 * JZ24反转链表
 */
public class 剑指Offer24_反转链表 {
    public ListNode reverseList(ListNode head) {
        ListNode newhead = null;
        while(head!=null){
            ListNode p = head.next;
            head.next = newhead;
            newhead = head;
            head = p;
        }
        return newhead;
    }
}
